﻿using System.Diagnostics;

namespace RaytracerLib
{
    [DebuggerStepThrough]
    public static class SingleExtensionsRaytracer
    {
        public static bool IsAlmostRelativeEquals(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostRelativeEquals(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostRelativeLessThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostRelativeLessThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostRelativeLessOrEqualThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostRelativeLessOrEqualThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostRelativeGreaterThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostRelativeGreaterThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostRelativeGreaterOrEqualThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostRelativeGreaterOrEqualThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostEquals(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostEquals(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostLessThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostLessThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostLessOrEqualThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostLessOrEqualThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostGreaterThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostGreaterThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        public static bool IsAlmostGreaterOrEqualThen(this float a_d1, float a_d2)
        {
            return TomanuExtensions.SingleExtensions.IsAlmostGreaterOrEqualThen(
                a_d1, a_d2, Constants.FLOAT_PRECISION);
        }

        /// <summary>
        /// Extension method may cause problem: -d.InRange(a, b) means -(d.AlmostRelvativeInRange(a,b))
        /// </summary>
        /// <param name="a_d"></param>
        /// <param name="a_min_inclusive"></param>
        /// <param name="a_max_inclusive"></param>
        /// <returns></returns>
        public static bool AlmostRelvativeInRange(float a_d, float a_min_inclusive,
            float a_max_inclusive)
        {
            Debug.Assert(a_min_inclusive <= a_max_inclusive);

            return TomanuExtensions.SingleExtensions.AlmostRelvativeInRange(a_d, a_min_inclusive, a_max_inclusive,
                Constants.FLOAT_PRECISION);
        }

        /// <summary>
        /// Extension method may cause problem: -d.InRange(a, b) means -(d.AlmostInRange(a,b))
        /// </summary>
        /// <param name="a_d"></param>
        /// <param name="a_min_inclusive"></param>
        /// <param name="a_max_inclusive"></param>
        /// <returns></returns>
        public static bool AlmostInRange(float a_d, float a_min_inclusive,
            float a_max_inclusive)
        {
            return TomanuExtensions.SingleExtensions.AlmostRelvativeInRange(a_d, a_min_inclusive, a_max_inclusive,
                Constants.FLOAT_PRECISION);
        }
    }
}